nums = [0, 1, 0, 3, 12]

if not nums:
    import sys
    sys.exit(0)

j = 0
for i in range(len(nums)):
    if nums[i]:
        nums[j] = nums[i]
        j += 1
for i in range(j, len(nums)):
    nums[i] = 0

print(nums)
